/****************************************************************************************
*            . .. .                                                                     *
*                    ...                                                                *
*                       .":                                                             *
*   .                      u                                                            *
* ..     .:uxkkOkkx=.      "k'                                                          *
*.     "k00O0ko==uk00x'     OO.                       IBE-CAE                           *
*'   .xK0O00: 'xx" x0Ku    .O0:     Copyright (C) by Internet Based Engineering         *
*   .O0OO00= oKOk:"O0O'    :00=                 All rights reserved.                    *
*.  =0OOO00" =OOO0Oo'     =0OO:                      www.ibe.cn                         *
*.  u0OOOO0O'          .o00OOO.                                                         *
* . :KOOOOO00xu=:::=uok00OOOO"                                                          *
*   .x00OOOOOO0000000OOOOOOx.                                                           *
*    .u00OOOOOOOOOOOOOOOOO=                                                             *
*      .ukOOOOOOOOOOOOku'                                                               *
*          .'::==::'.                                                                   *
****************************************************************************************/

#ifndef IBE_DATA_INFORMATION_TO_VTK_H_
#define IBE_DATA_INFORMATION_TO_VTK_H_

#include "IBE_DataInformation.h"
#include "IBE_Object.h"
#include "IBE_Vtk_Export.h"

#include <map>
#include <vector>

class vtkMultiBlockDataSet;

namespace ibe_vtk
{
    /**
    * @class IBE_DataInformationToVTK
    * @brief 将IBE_DataInformation转换为VTK格式
    * @author liupeng
    */
    class IBE_VTK_EXPORT IBE_DataInformationToVTK : public ibe_common::IBE_Object
    {
    public:
        explicit IBE_DataInformationToVTK();
        ~IBE_DataInformationToVTK();

        IBE_TypeMacro( ibe_vtk, IBE_DataInformationToVTK, ibe_common, IBE_Object );

        virtual void Initialize() override;
        virtual void InitData();

        //@{
        /**
        * @brief 设置要转换数据的信息
        *
        * @param newDataInfo 数据信息
        */
        virtual void SetDataInformation( ibe_common::IBE_DataInformation* newDataInfo );
        virtual ibe_common::IBE_DataInformation* GetDataInformation()
        {
            return this->dataInfo_;
        }
        //@}

        virtual void Update();

        /**
         * @brief 获取转换后的vtk数据
         *
         * @return 转换后的vtk数据
         */
        virtual vtkMultiBlockDataSet* GetOuputData();

        /**
        * @brief 将数据输出为VTK格式
        *
        * @param outputPath 输出路径（文件夹路径）
        * @param dataMode 输出格式：0-vtkXMLWriter::Ascii, 1-vtkXMLWriter::Binary, 2-vtkXMLWriter::Appended
        * @return 返回输出文件路径，std::map<".vtm.series",std::map<".vtm",std::vector<".vtu">>
        */
        virtual std::map<std::string, std::map<std::string, std::vector<std::string>>> WriteDataToVtk( const std::string &outputPath, int dataMode = 0 );
        /**
        * @brief 将数据输出为VTK格式
        *
        * @param data 要输出的vtk数据
        * @param outputPath 输出路径（文件夹路径）
        * @param dataMode 输出格式：0-vtkXMLWriter::Ascii, 1-vtkXMLWriter::Binary, 2-vtkXMLWriter::Appended
        * @return 返回输出文件路径，std::map<".vtm.series",std::map<".vtm",std::vector<".vtu">>
        */
        virtual std::map<std::string, std::map<std::string, std::vector<std::string>>> WriteDataToVtk( vtkMultiBlockDataSet* data, const std::string &outputPath, int dataMode = 0 );

    protected:
        ibe_common::IBE_DataInformation* dataInfo_;

        //! 存储所有分析步数据
        vtkMultiBlockDataSet* outputData_;

    private:
        IBE_DataInformationToVTK( const IBE_DataInformationToVTK& ) = delete;
        IBE_DataInformationToVTK& operator=( const IBE_DataInformationToVTK& ) = delete;
    };
} // namespace ibe_vtk

#endif // IBE_DATA_INFORMATION_TO_VTK_H_